package com.rfid.emergencywarehouse.adapter;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.base.base.BaseAdapter;
import com.rfid.emergencywarehouse.R;
import com.rfid.emergencywarehouse.entity.Order;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class OrderAdapter extends BaseAdapter<OrderAdapter.MyHolder, Order> {


    public OrderAdapter(List<Order> data) {
        super(data);
    }

    @Override
    protected int getLayout() {
        return R.layout.item_order;
    }

    @Override
    protected MyHolder getViewHolder(View view) {
        return new MyHolder(view);
    }

    @Override
    protected void bindView(MyHolder holder, int position, Order t) {
        Order order = mData.get(position);
        holder.order.setText(String.format("上架单号：%s",order.getOriginOrderNo()));
        holder.date.setText(String.format("创建时间： %s",order.getCreateTime()));
        holder.creator.setText(String.format("由%s创建",order.getCreateUserName()));
        holder.kf.setText(String.format("库房： %s",order.getToWorkAreaName()));
    }

    class MyHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.order_num)
        TextView order;
        @BindView(R.id.kf)
        TextView kf;
        @BindView(R.id.status)
        TextView status;
        @BindView(R.id.date)
        TextView date;
        @BindView(R.id.creator)
        TextView creator;
        @BindView(R.id.detail)
        TextView detail;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
